﻿using System;

namespace Lypshare.Net.Client.Packets
{
	/// <summary>
	/// Unknown packet.
	/// </summary>
	/// <exception cref='ArgumentNullException'>
	/// Is thrown when an argument passed to a method is invalid because it is <see langword="null" /> .
	/// </exception>
    public class UnknownPacket : Packet
    {
        // --------------------------------------------------------
        // Class Properties
        // --------------------------------------------------------


        /// <summary>
        /// Gets or sets the data.
        /// </summary>
        /// <value>
        /// The data.
        /// </value>
        public byte[] Data
        {
            get;
            set;

        } // Property: Data


        // --------------------------------------------------------
        // Class Function
        // --------------------------------------------------------


        /// <summary>
        /// Parse the specified buffer.
        /// </summary>
        /// <param name='buffer'>
        /// Buffer.
        /// </param>
        /// <exception cref='ArgumentNullException'>
        /// Is thrown when an argument passed to a method is invalid because it is <see langword="null" /> .
        /// </exception>
        protected override void Parse(PacketBuffer buffer)
        {
            if (buffer == null)
                throw new ArgumentNullException("buffer");

            Data = buffer.Data;

        } // Parse


        /// <summary>
        /// Encode the specified buffer.
        /// </summary>
        /// <param name='buffer'>
        /// Buffer.
        /// </param>
        /// <exception cref='ArgumentNullException'>
        /// Is thrown when an argument passed to a method is invalid because it is <see langword="null" /> .
        /// </exception>
        protected override void Encode(PacketBuffer buffer)
        {
            if (buffer == null)
                throw new ArgumentNullException("buffer");

            buffer.Write(Data, 0, Data.Length);

        } // Encode

    } // class UnknownPacket
} // namespace Lypshare.Net.Client.Packets